From: Florian Müllner Date: Tue, 18 Feb 2020 18:05:47 +0000 (+0100) Subject: ci: Check that files with translatable strings are listed in POTFILES X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~772^2^2~20 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7a0c866d97eb1d98d9a651875bbb79fd0539fa2f;p=gnome-shell.git ci: Check that files with translatable strings are listed in POTFILES Also known as "Piotr Drąg Bot". We will soon make sure that files processed by xgettext don't use template strings. To make that check as adequate as possible, ensure that no source code files are missing from POTFILES. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1016 --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6e5862444..3b4d23ab9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,6 +46,13 @@ eslint: - reports when: always +potfile_check: + image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v1 + stage: review + script: + - ./.gitlab-ci/check-potfiles.sh + <<: *only_default + build: image: registry.gitlab.gnome.org/gnome/mutter/master:v3 stage: build diff --git a/.gitlab-ci/check-potfiles.sh b/.gitlab-ci/check-potfiles.sh new file mode 100755 index 000000000..51cbdd89a --- /dev/null +++ b/.gitlab-ci/check-potfiles.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +srcdirs="js src subprojects/extensions-tool" +globs=('*.js' '*.c') + +# find source files that contain gettext keywords +files=$(grep -lR ${globs[@]/#/--include=} '\(gettext\|[^I_)]_\)(' $srcdirs) + +# find those that aren't listed in POTFILES.in +missing=$(for f in $files; do ! grep -q ^$f po/POTFILES.in && echo $f; done) + +if [ ${#missing} -eq 0 ]; then + exit 0 +fi + +cat >&2 <&2 +done +echo >&2 + +exit 1